package com.itheima.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.entity.UserGift;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

/**
 * @author liudo
 * @version 1.0
 * @project mybatis-plus-quick-start
 * @date 2023/12/22 15:52:41
 */
@Mapper
public interface UserGiftMapper extends BaseMapper<UserGift> {
    @Update("update user_gift set amount = amount - 1, version = version + 1 where version = #{version} and id = #{id}")
    int updateVersion(Long id, Integer version);
}
